//
//  UIImageView+SD.m
//  VICategory
//
//  Created by MN on 2022/6/29.
//

#import "UIImageView+SD.h"
#import "SDWebImage.h"

@implementation UIImageView (SD)

- (void)vi_imageWithUrl:(nullable NSString *)url{
    [self vi_imageWithUrl:url placeholderImage:nil];
}
- (void)vi_imageWithUrl:(nullable NSString *)url
       placeholderImage:(nullable UIImage *)placeholderImage{
    [self vi_imageWithUrl:url placeholderImage:placeholderImage completed:nil];
}

- (void)vi_imageWithUrl:(nullable NSString *)url
       placeholderImage:(nullable UIImage *)placeholderImage
              completed:(nullable void (^)(UIImage * _Nullable image))completed{
    
    [self sd_setImageWithURL:[NSURL URLWithString:url]
            placeholderImage:placeholderImage
                     options:SDWebImageAllowInvalidSSLCertificates
                   completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
        if (completed) completed(image);
    }];
}
@end
